<?php use_helper('I18N') ?>
<h1>Pay periods List</h1>

<table>
  <thead>
    <tr>
      <th>Id</th>
      <th>Name</th>
      <th>Start date</th>
      <th>End date</th>
      <th>Payment periodicity</th>
      <th>Acciones</th>
    </tr>
  </thead>
  <tbody>
    <?php foreach ($pager->getResults() as $i => $pay_period): ?>
    <tr>
      <td><a href="<?php echo url_for('payperiod/show?id='.$pay_period->getId()) ?>"><?php echo $pay_period->getId() ?></a></td>
      <td><?php echo $pay_period->getName() ?></td>
      <td><?php echo $pay_period->getStartDate() ?></td>
      <td><?php echo $pay_period->getEndDate() ?></td>
      <td><?php echo $pay_period->getPaymentPeriodicityId() ?></td>
      <td>
          <?php if(!$pay_period->hasTimeCards()): ?>
          <a href="<?php echo url_for('payperiod/createTimeCards?id='.$pay_period->getId()) ?>">Crear Tarjetas de Tiempo</a>
          <?php endif; ?>
      </td>
    </tr>
    <?php endforeach; ?>
  </tbody>
</table>
<?php include_partial('global/pagination', array('pager' => $pager, 'module' => 'payperiod')) ?>
<a href="<?php echo url_for('payperiod/new') ?>">New</a>
<script type="text/javascript">
    $('tbody tr:even').addClass('even');
    $('tbody tr:odd').addClass('odd');
</script>
